package com.neusoft.crm.controller;


import com.neusoft.crm.entity.CommonResult;
import com.neusoft.crm.entity.Dept;
import com.neusoft.crm.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  部门管理模块前端控制器
 * </p>
 *
 * @author 东方红
 * @since 2023-03-22
 */
@RestController
@RequestMapping("/dept")
@CrossOrigin
public class DeptController {

    @Autowired
    IDeptService deptService;

    @GetMapping("/q/all")
    public CommonResult getAll(){
        return   deptService.getAll();
    }

    @PutMapping("/add")
    public  CommonResult  addDept(@RequestBody Dept dept ){
        return  deptService.addDept( dept );
    }

    @PostMapping("/mod")
    public CommonResult modDept(@RequestBody Dept dept ){
        return  deptService.modDept(dept);
    }
    //    '/del/' + row.deptno
    @DeleteMapping("/del/{deptno}")
    public  CommonResult delDept(@PathVariable("deptno")  String deptno ){
        return   deptService.delDept(    deptno );
    }


}
